package com.jari.lg.service.profile.carstatistic;

import com.jari.lg.domain.NightOutCarEntity;
import com.jari.lg.mapper.NightOutCarEntityMapper;
import com.jari.lg.utils.Constants;
import com.jari.lg.utils.Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class CarNightOutService {

    @Autowired
    private NightOutCarEntityMapper nightOutCarEntityMapper;

    /*
     *   不涉及卡口，每天插入1000条记录
     * */
    @Scheduled(cron = "* */1 * * * ?")
    public void makeInfo(){
        NightOutCarEntity entity;

        for(int i = 0 ; i < 1000; i ++){
            entity = generate();
            nightOutCarEntityMapper.insert(entity);
        }
    }

    private NightOutCarEntity generate(){
        NightOutCarEntity entity = new NightOutCarEntity();
        entity.setCreator("SYS");
        entity.setGmtcreate(new Date());
        entity.setDatastatus(Constants.DATA_STATUS_ONE);
        entity.setPlatenumber(Utils.createPlateNumber());
        entity.setPlatetype(Utils.createPlateType());
        return  entity;
    }
}
